<?php
include "../../public/common/config.php";

$id = $_GET['id'];
$sql = "select * from advert where id={$id}";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="../public/css/common.css"/>
	</head>
	<body>
		<div class="main">
			<form action="update.php" method="post" enctype="multipart/form-data">
				<p>
					<label>位置：</label>
					<select name="pos">
						<?php
						switch($row['pos']){
							case 0:
								echo "<option value='0' selected>0</option>";
								echo "<option value='1'>1</option>";
							break;
							case 1:
								echo "<option value='0'>0</option>";
								echo "<option value='1' selected>1</option>";
							break;
						}
						?>
					</select>
				</p>
				<p>
					<label>原图：</label>
				</p>
				<p>
					<img src="../public/uploads/<?php echo $row['img']?>" width="200" />
				</p>
				<p>
					<label>图片：</label>
					<input type="file" name="img" />
				</p>
				<p>
					<label>U R L ：</label>
					<input type="text" name="url" value="<?php echo $row['url']?>" />
				</p>
				<input type="hidden" name="imgsrc" value="<?php echo $row['img']?>" />
				<input type="hidden" name="id" value="<?php echo $row['id']?>" />
				<p><input type="submit" value="更新"/></p>
			</form>
		</div>
	</body>
	
</html>